<?php

namespace core\event;

use app\bll\User as BllUser;
use app\bll\UserIntegralRule as BllUserIntegralRule;

/**
 * 积分
 */
class Integral
{

    public function dispatch($param)
    {
        if (isset($param['data']['uid'])) {
            $bllUser = new BllUser();
            $bllUserIntegralRule = new BllUserIntegralRule();
            $rules = $bllUserIntegralRule->selectByHookident($param['ident']); //当前钩子下的积分规则
            foreach ($rules as $rule) {
                $bllUser->obtainIntegralByRule($param['data']['uid'], $rule);
            }
        }
    }
}
